<%--
</html>
&lt;%&ndash;
  Created by IntelliJ IDEA.
  User: cc
  Date: 2022/8/16
  Time: 13:37
  To change this template use File | Settings | File Templates.
                    <th>房间号</th>
                    <th>房间类型</th>
                    <th>房间价格</th>
                    <th>房间状态</th>
                    <th>客户</th>
                    <th>电话号码</th>
                    <th>身份证</th>
                    <th>入住时间</th>
                    <th>退房时间</th>
                    <th>操作</th>
&ndash;%&gt;
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>userAdd</title>
    <!-- 通过cdn的方式引入，需要连网 -->
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="${pageContext.request.contextPath}/static/js/vue.min.js" type="text/javascript"></script>
    <!-- 解决浏览器生产提示信息 -->
    <script> Vue.config.productionTip=false </script>
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <!-- 引入vue.js -->
    <script src="${pageContext.request.contextPath}/static/js/jquery-2.1.1.min.js" type="text/javascript"></script>
</head>
<body>
<div id="app">
    <el-form ref="form" :model="OrderInfoManager" label-width="80px">
        <el-form-item label="房间号">
            <el-input type="number" v-model="OrderInfoManager.roomId"></el-input>
        </el-form-item>
        <el-form-item label="房间类型">
            <el-input v-model="OrderInfoManager.roomType"></el-input>
        </el-form-item>
        <el-form-item label="房间价格">
            <el-input type="number" v-model="OrderInfoManager.roomPrice"></el-input>
        </el-form-item>
        <el-form-item label="房间状态">
            <el-input type="number" v-model="OrderInfoManager.roomState"></el-input>
        </el-form-item>
        <el-form-item label="客户">
            <el-input v-model="OrderInfoManager.userName"></el-input>
        </el-form-item>
        <el-form-item label="电话">
            <el-input type="number" v-model="OrderInfoManager.userPhone"></el-input>
        </el-form-item>
        <el-form-item label="身份证">
            <el-input v-model="OrderInfoManager.userIdCard"></el-input>
        </el-form-item>
        <el-form-item label="入住时间">
            <el-input v-model="OrderInfoManager.checkInDate"></el-input>
        </el-form-item>
        <el-form-item label="退房时间">
            <el-input type="number" v-model="OrderInfoManager.checkOutDate"></el-input>
        </el-form-item>

        <el-form-item>
            <el-button type="primary" @click="insertUser">新增用户</el-button>
        </el-form-item>
    </el-form>
</div>
<script>
    new Vue({
        el:'#app',
        data:{
            OrderInfoManager:{
                roomId:"",
                roomType:"",
                roomPrice:"",
                roomState:"",
                userName:"",
                userPhone:"",
                userIdCard:"",
                checkInDate:"",
                checkOutDate:"",

            }
        },
        methods:{
            insertUser(){
                console.log(this.OrderInfoManager)
                var _this = this;
                $.ajax({
                    url:'${pageContext.request.contextPath}/Order/selectOrder',
                    dataType:'json',
                    type:'post',
                    data:{
                        roomId:this.OrderInfoManager.roomId,
                        roomType:this.OrderInfoManager.roomType,
                        roomPrice:this.OrderInfoManager.roomPrice,
                        roomState:this.OrderInfoManager.roomState,
                        userName:this.OrderInfoManager.userName,
                        userPhone:this.OrderInfoManager.userPhone,
                        userIdCard:this.OrderInfoManager.userIdCard,
                        checkInDate:this.OrderInfoManager.checkInDate,
                        checkOutDate:this.OrderInfoManager.checkOutDate,
                    },
                    success:function (rs) {
                        if (rs.code == 200){
                            _this.$alert(rs.msg+",2秒之后回到用户列表")
                            setTimeout(function () {
                                location.href = '${pageContext.request.contextPath}/userList';
                            })
                        }else {
                            _this.$alert(rs.msg)
                        }
                    }
                })
            }
        },
        mounted(){
        }
    })
</script>
</body>
</html>
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>

<%--
  Created by IntelliJ IDEA.
  User: ZhangYao
  Date: 2022/8/12
  Time: 17:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <title>客户界面</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style>
        h1{
            text-align: center;
            color: black;
            font-size: 18px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row clerfix">
        <div class="col-md-12 colum">
            <div class="page-header" >
                <h1>
                    <small>显示所有客户</small>
                </h1>

            </div>
        </div>
        <div class="row">
            <div class="col-md-4 column">
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/Order/toInsertOrder">增加客户</a>
            </div>
            <div class="col-md-4 column"></div>
            <div class="col-md-4 column">
                <form class="form-inline" action="${pageContext.request.contextPath}/Order/referUserName?userName=${userName}" method="get" style="float: right">
                    <span style="color: red; font-weight:bold">${error}</span>
                    <input type="text" name="userName" class="form-control" placeholder="请输入客户名字">
                    <input type="submit" value="查询" class="btn btn-primary">
                </form>
            </div>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 colum">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>姓名</th>
                    <th>电话</th>
                    <th>身份证</th>
                    <th>入住时间</th>
                    <th>退房时间</th>
                    <th>房间号</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>

                <c:forEach var="Order" items="${list}">
                    <tr>
                        <td>${Order.userName}</td>
                        <td>${Order.userPhone}</td>
                        <td>${Order.userIdCard}</td>
                        <td>${Order.checkInDate}</td>
                        <td>${Order.checkOutDate}</td>
                        <td>${Order.roomId}</td>
                        <td>
<%--                            <a href="${pageContext.request.contextPath}/Order/selectRoomManager">房态</a>--%>
                            <a href="${pageContext.request.contextPath}/Order/deleteUserInfo?userPhone=${Order.userPhone}">删除</a>
                            <a href="${pageContext.request.contextPath}/Order/toInsertOutOrder?checkOutDate=${Order.checkOutDate}&userPhone=${Order.userPhone}">退房</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>

</body>
</html>
